package com.ruoyi.web.controller.system;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.Courses6;
import com.ruoyi.system.service.ICourses6Service;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 成绩表6Controller
 * 
 * @author ruoyi
 * @date 2025-02-14
 */
@RestController
@RequestMapping("/system/courses_6")
public class Courses6Controller extends BaseController
{
    @Autowired
    private ICourses6Service courses6Service;

    /**
     * 查询成绩表6列表
     */
    @PreAuthorize("@ss.hasPermi('system:courses_6:list')")
    @GetMapping("/list")
    public TableDataInfo list(Courses6 courses6)
    {
        startPage();
        List<Courses6> list = courses6Service.selectCourses6List(courses6);
        return getDataTable(list);
    }

    /**
     * 导出成绩表6列表
     */
    @PreAuthorize("@ss.hasPermi('system:courses_6:export')")
    @Log(title = "成绩表6", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, Courses6 courses6)
    {
        List<Courses6> list = courses6Service.selectCourses6List(courses6);
        ExcelUtil<Courses6> util = new ExcelUtil<Courses6>(Courses6.class);
        util.exportExcel(response, list, "成绩表6数据");
    }

    /**
     * 获取成绩表6详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:courses_6:query')")
    @GetMapping(value = "/{courseId}")
    public AjaxResult getInfo(@PathVariable("courseId") Long courseId)
    {
        return success(courses6Service.selectCourses6ByCourseId(courseId));
    }

    /**
     * 新增成绩表6
     */
    @PreAuthorize("@ss.hasPermi('system:courses_6:add')")
    @Log(title = "成绩表6", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody Courses6 courses6)
    {
        return toAjax(courses6Service.insertCourses6(courses6));
    }

    /**
     * 修改成绩表6
     */
    @PreAuthorize("@ss.hasPermi('system:courses_6:edit')")
    @Log(title = "成绩表6", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody Courses6 courses6)
    {
        return toAjax(courses6Service.updateCourses6(courses6));
    }

    /**
     * 删除成绩表6
     */
    @PreAuthorize("@ss.hasPermi('system:courses_6:remove')")
    @Log(title = "成绩表6", businessType = BusinessType.DELETE)
	@DeleteMapping("/{courseIds}")
    public AjaxResult remove(@PathVariable Long[] courseIds)
    {
        return toAjax(courses6Service.deleteCourses6ByCourseIds(courseIds));
    }
}
